package priv.yiyuan.example.design.bridge;

/**
 * 电子钱包支付
 * <p>
 * 扩展抽象部分
 *
 * @author YiYuan
 * @data 2025/8/5
 * @apoNote
 */
public class DigitalWalletPayment extends PaymentMethod {

    private String walletId;

    public DigitalWalletPayment(PaymentGateway paymentGateway, String walletId) {
        super(paymentGateway);
        this.walletId = walletId;
    }

    @Override
    public boolean pay(double amount) {
        System.out.println(String.format("电子钱包支付: %s\n", walletId));
        return super.paymentGateway.processPayment(amount, "MERCHANT_ACC", "CUSTOMER_ACC");
    }

    @Override
    public boolean refund(double amount) {
        System.out.println(String.format("电子钱包退款: %s\n", walletId));
        return super.paymentGateway.processPayment(amount, "CUSTOMER_ACC", "MERCHANT_ACC");
    }
}
